<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box{
            position: absolute;
            left: 0;
            width: 100px;
            height: 100px;
            background-color: red;
            display: none;
        }
    </style>

    <script src="../框架相关的js/vue.js"></script>
</head>

<body>
    <!-- dom的更新是异步的，无法通过同步代码获取 -->
    <!-- 如果我们需要获取数据更新后的dom信息，比如动态获取dom的宽高、位置等，就需要使用nextTick。 -->
    <div id="example">{{message}}
        <div ref="ma" id="box">
            {{msg}}
        </div>
        <button @click="fn">改变数据</button>
    </div>
  
    <div id="box1">
        原生的dom
    </div>
    <button onclick="fn1()">点击</button>

    <script>
         
         function fn1(){
            document.getElementById('box1').innerText='更改后的原生的dom'
            console.log( document.getElementById('box1').innerText,'????');
         }
        var vm = new Vue({
            el: '#example',
            data: {
                message: '123',
                msg: '原来的val'
            },
            methods: {
                fn() {
                    document.getElementById('box').style.display='block'
                    this.msg = '新的val'
                    document.getElementById('box').style.left=100+'px'
                    console.log(  this.$refs.ma.style.left,'左边');
                    console.log(document.getElementById('box').innerText, '数据1');
                    console.log(this.$refs.ma.innerText, '数据2');
                    console.log(this.$el,'/');
                }
            },
        })
        vm.message = 'new message' // 更改数据
        vm.$el.textContent === 'new message' // false
        // console.log(vm.$el.textContent,'外面的');
        Vue.nextTick(function () {
            vm.$el.textContent === 'new message' // true
            //   console.log(  vm.$el.textContent,'nexttick里面的');
        })
    </script>
</body>

</html>